The problem of maximizing the score of a pathway